/**
  ******************************************************************************
  * @file    zqfifo.h
  * @author  Aizbot
  * @brief   xxx.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2023 Aizbot.
  * All rights reserved.</center></h2>
  *
  * http://www.aizbot.com
  *
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ZQFIFO_H
#define __ZQFIFO_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "common.h"

/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
#ifdef ZQFIFO_C
#define ZQFIFO_EXT
#else
#define ZQFIFO_EXT extern
#endif

/* Exported types ------------------------------------------------------------*/
/** 
  * @brief  xxx
  */  
typedef struct
{
	uint16_t	size;
	int32_t 	write;
	int32_t 	read;
	uint8_t		*buffer;//buffer[MAX_FIFO_SIZE];
}Zqfifo_t;

/* Exported variables --------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
ZQFIFO_EXT void 	 Zqfifo_Init( Zqfifo_t *fifo, uint8_t *buf, uint16_t size);
ZQFIFO_EXT void 	 Zqfifo_Write(Zqfifo_t *fifo, uint8_t data);
ZQFIFO_EXT uint8_t  Zqfifo_Read(Zqfifo_t *fifo);
ZQFIFO_EXT uint16_t Zqfifo_Count(Zqfifo_t *fifo);
ZQFIFO_EXT uint8_t  Zqfifo_GetCurrentValue(Zqfifo_t *fifo);
ZQFIFO_EXT uint8_t  Zqfifo_GetPreviousValue(Zqfifo_t *fifo);

#ifdef __cplusplus
}
#endif

#endif /* __ZQFIFO_H */

/************************ (C) COPYRIGHT Aizbot ********************************/
